package com.uniview.config;

import com.uniview.interceptor.GlobalInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * created by lux
 */
@Configuration
@Slf4j
public class GlobalSecurityConfig implements WebMvcConfigurer{
    @Autowired
    Environment environment;
    @Autowired
    private GlobalInterceptor globalInterceptor;
    /**
     * @desc 全局拦截器
     * @param registry 拦截器注册工厂
     */
    @Override
    public  void addInterceptors(InterceptorRegistry registry) {
        //配置全局拦截器
        registry.addInterceptor(globalInterceptor)
                .addPathPatterns("/**");
    }
}
